{extend name='admin@main'}

{block name="content"}

{include file='part/form_style'}

<form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card res_field_form' lay-filter="form_sub" autocomplete="off">

    <div class="layui-card-body think-box-shadow padding-left-40">

        <!--<div class="layui-form-item">-->
            <!--<label class="relative block">-->
                <!--<span class="color-green font-w7 label-required-prev">车型</span>-->
            <!--</label>-->
            <!--<select required class="layui-select" name="hb_id" lay-search>-->
                <!--<option value="">请选择车型</option>-->
                <!--{foreach hatchback as $v}-->
                <!--{if isset($vo.hb_id) && $v.id eq $vo.hb_id}-->
                <!--<option value="{$v.id}" selected>{$v['name']}</option>-->
                <!--{else}-->
                <!--<option value="{$v.id}">{$v['name']}</option>-->
                <!--{/if}-->
                <!--{/foreach}-->
            <!--</select>-->
        <!--</div>-->

        <div class="layui-form-item layui-row layui-col-space15">
            <span class="color-green label-required-prev">部位名称</span>
            <input name="part_name" required class="layui-input" placeholder="请输入部位名称" value="{$vo.part_name|default=''}">
        </div>

        <div class="layui-form-item layui-row layui-col-space15">
            <span class="color-green label-required-prev">部位更新指令</span>
            <input name="update_instruct" required class="layui-input" placeholder="请输入部位更新指令" value="{$vo.update_instruct|default=''}">
        </div>

        <div class="layui-form-item text-center">
            <input type="hidden" name="isAddMode" value="{$isAddMode}">
            {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
            <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" type="button">取消</button>
            <button class="layui-btn" type="submit">保存</button>
        </div>

    </div>
</form>
{/block}

{block name='script'}
<textarea class="layui-hide" id="goods-specs">{$vo.specs|raw|default=''}</textarea>
<textarea class="layui-hide" id="goods-value">{$defaultValues|raw|default=''}</textarea>
<script>
    window.form.render();
    require(['ckeditor', 'angular'], function () {
        var app = angular.module("GoodsForm", []).run(callback);
        angular.bootstrap(document.getElementById(app.name), [app.name]);

        function callback($rootScope) {
            $rootScope.isAddMode = parseInt('{$isAddMode|default=0}');
            // 返回项目列表
            $rootScope.hsitoryBack = function () {
                $.msg.confirm('确定要取消编辑吗？', function (index) {
                    history.back(), $.msg.close(index);
                });
            };

        }
    })
</script>

{/block}